import Vue from 'vue'
import VueRouter from 'vue-router'

import Detail from '@/views/detail'
import Register from '@/views/register'
import Layout from '@/views/layout'
import Login from '@/views/login'

import Home from '@/views/home'
import House from '@/views/house'
import News from '@/views/news'
import My from '@/views/my'

Vue.use(VueRouter)

const routes = [
  {
    path: '/login',
    component: Login
  },
  {
    path: '/',
    component: Layout,
    redirect: '/home',
    children: [
      {
        path: '/home',
        component: Home
      },
      {
        path: '/house',
        component: House
      },
      {
        path: '/news',
        component: News
      },
      {
        path: '/my',
        component: My
      }
    ]
  },
  {
    path: '/register',
    component: Register
  },
  {
    path: '/detail',
    component: Detail
  }
]

const router = new VueRouter({
  routes
})

export default router
